import Vue from 'vue'
import VueRouter from 'vue-router'

// ===========================================前台
import student from '@/views/student/lay.vue'

import studentHome from '@/views/student/home/home.vue'
import homePaper from '@/views/student/home/homePaper.vue'
import homeAnswer from '@/views/student/home/homeAnswer.vue'
import homeTopic from '@/views/student/home/homeTopic.vue'

import code from '@/views/student/code/code.vue'
import studentPaper from '@/views/student/paper/paper.vue'


// ===========================================后台
import admin from '@/views/admin/lay.vue'

import adminHome from '@/views/admin/home/home.vue'

import adminTopic from '@/views/admin/topic/topic.vue'
import adminTopicEdit from '@/views/admin/topic/topicEdit.vue'

import adminPaper from '@/views/admin/paper/paper.vue'
import adminPaperEdit from '@/views/admin/paper/paperEdit.vue'
import adminPapaerStatistics from '@/views/admin/paper/papaerStatistics.vue'

import adminAnswerItemList from '@/views/admin/answer/adminAnswerItemList.vue'
import adminAnswerList from '@/views/admin/answer/adminAnswerList.vue'
import adminAnswerDetail from '@/views/admin/answer/adminAnswerDetail.vue'

// ===========================================认证
import login from '@/views/auth/login.vue'


Vue.use(VueRouter)

const routes = [
    {
        path: '*',
        redirect : '/student/homePaper'
    },
    {
        path: '/student',
        component: student,
        redirect : '/student/homePaper',
        children : [
            {
                path: '/student/home',
                component: studentHome,
                children : [
                    {
                        path: '/student/homePaper',
                        component: homePaper,
                    },
                    {
                        path: '/student/homeAnswer',
                        component: homeAnswer,
                    },
                    {
                        path: '/student/homeTopic',
                        component: homeTopic,
                    },
                ]
            },
            {
                path: '/student/code',
                component: code,
                meta : {
                    footerNoShow : true
                }
            },
            {
                path: '/student/paper',
                component: studentPaper,
            }
        ]
    },
    {
        path: '/admin',
        component: admin,
        redirect : '/admin/home',
        children : [
            {
                path: '/admin/home',
                component: adminHome,
            },
            {
                path: '/admin/topicList',
                component: adminTopic,
            },
            {
                path: '/admin/topicEdit',
                component: adminTopicEdit,
            },
            {
                path: '/admin/paperList',
                component: adminPaper,
            },
            {
                path: '/admin/papaerStatistics',
                component: adminPapaerStatistics,
            },
            {
                path: '/admin/paperEdit',
                component: adminPaperEdit,
            },,
            {
                path: '/admin/answerItemList',
                component: adminAnswerItemList,
            },
            {
                path: '/admin/answerList',
                component: adminAnswerList,
            },
            {
                path: '/admin/adminAnswerDetail',
                component: adminAnswerDetail,
            },
        ]
    },
    {
        path: '/login',
        component: login,
    }
]

const router = new VueRouter({
    routes
})

export default router
